All Questions
Tagged with design-patternsperformance
44 questions
1vote
1answer
284views
Rules-engine to be improved/simplified for Efficiency (performance), Extensibility and Maintenance?
This is a simple implementation of a rules engine. I am really hating the very long MATCH/CASE function. I am wondering what kind of Design Patterns could be used there to make this code more ...
4votes
1answer
69views
Terminal Graphical Visualizer, using a queue of different matrices
I built a project in which I provide a string input or a whole matrix to configure a frame, create a bunch of different frames and push them into a queue and finally print them in order of the queue. ...
8votes
1answer
242views
Lightweight general-purpose graph library in C++
As a personal side project I started building a graph library in C++ (I know, very original). The code is open source, but for the purpose of this question I will provide the relevant details and the ...
2votes
0answers
62views
Pre setup script to get user metadata and check supported api's within the browser/device
Can this code be shortened or optimized, Written out this script to be used before node.js starts a few canvas elements and some vide streams. wondering if the initial checks can be shortend or ...
4votes
0answers
59views
How to split and refactor a large function so it would do only one thing?
I am learning about clean and maintainable code. I heard that functions should be no more than 20 lines long (preferably 5 - 10 lines). I have come across this Bob Martin quote where he said: “The ...
4votes
1answer
870views
A Python tkinter Activity Planner (To-do List)
I have created a simple Activity Planner that allows adding tasks and associated sub-tasks. It is mainly based on the Treeview widget. This being my first GUI-based ...
4votes
3answers
1kviews
Thread-safe "singleton" that destroys object when not used anymore
I'm working on some legacy code which uses the singleton pattern. The problem I have with the traditional singleton is that the instance lives until the program terminates. This is messing up the ...
13votes
2answers
10kviews
Binary Search Tree Data Structure Implementation in C++11 using Smart Pointers
This implementation is part of my open source project forest. I wrote the following header file to implement a binary search tree data structure that supports the following operations: Insert Search ...
5votes
2answers
6kviews
Rest API for realtime statistics of last 60 seconds
The following code is my solution to a code challenge I submitted a few weeks ago. I got rejected straight away with no feedback and I've wondering why. I'm interested in hearing if there is any ...
2votes
1answer
15kviews
Check OpenVPN's connection status
I wrote a method that will start OpenVPN on a config file, and then wait to be connected. It relies on OpenVPN using Local Area Connection 2, which hurts code reusability, but I'm not sure how to do ...
2votes
1answer
150views
Modelling an account manager in OOP
I have this task of modelling a system where given a group of users each can keep track of their expenses. The basic requirements are as followed: To be able to give credit to an user. Find all the ...
2votes
2answers
223views
A trip down the single method interface rabbit hole
I responded to this question about designing around interdependant methods with the strategy pattern. Afterwards I started thinking about the functional additions to java 8 and wondered if I was ...
2votes
2answers
179views
Sending an SMS message using zenoss and python
I have just finished a simple python script which uses this module to call Zenoss API for getting live events. What the script does: connects to zenoss reads a file which has one phone number on each ...
1vote
2answers
842views
Which is correct : Open one Connection for inserting List of objects or open connection for every single insertion?
I have written the following method twice but I don't know which is better from performance perspective, code design and best practice. First: ...
1vote
2answers
146views
Array class to replace all iterator needs
Following dreams, I have started learning Java for Game Programing purposes and, during code I figured out that Iterators such as Queue, Lists, Arraylists and what not are very common. I have written ...